using System;
using System.Reflection;
using UnityEngine;
using UnityEngine.Events;
#if UNITY_EDITOR
using UnityEditor.Events;
#endif
using static WaterCylinder.Mouse;
[Serializable]
public class WeaponEvent : UnityEvent<Weapon,int>, IFunctionEvent{
    
    public void Add(MethodInfo method){
        #if UNITY_EDITOR
        UnityEventTools.AddPersistentListener(
            this,
            Delegate.CreateDelegate(typeof(UnityAction<Weapon,int>), method) as UnityAction<Weapon,int>
        );
        #endif
    }
    
}
public class WeaponFunction : ItemFunction
{
    public static void NormalShot(Weapon weapon, int id){
        Vector2 toward = GetMousePosition2D() - weapon.owner.weaponPos;
        weapon.Shot(id);
        weapon.currentBullet.toward = toward;
    }
}
